<!--********************************************************************
* Copyright© 2000 - 2025 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!--********************************************************************
* 该示例需要引入
* Mapv (https://github.com/huiyan-fe/mapv)
*********************************************************************-->
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title data-i18n="resources.title_mapVLayerPolygon"></title>
        <script type="text/javascript" include="jquery" src="../js/include-web.js"></script>
    </head>
    <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
        <div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
        <script type="text/javascript" include="mapv" src="../../dist/leaflet/include-leaflet.js"></script>
        <script type="text/javascript">
            var map = L.map('map', {
                center: [39.93, 116.402],
                zoom: 12
            });

            var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
            var url = host + '/iserver/services/map-china/rest/maps/ChinaDark';

            new L.supermap.TiledMapLayer(url).addTo(map);
            loadData();

            //示例数据来源为百度MapV的加偏数据，iClient未做纠偏处理
            function loadData() {
                $.get('../data/beijing-village.json', function(geojson) {
                    var dataSet = new mapv.DataSet(geojson);

                    var options = {
                        fillStyle: 'rgba(255, 80, 53, 0.8)',
                        strokeStyle: 'rgba(250, 255, 53, 0.8)',
                        lineWidth: 1,
                        draw: 'simple'
                    };

                    var dataAttr =
                        resources.text_dataSources +
                        "<a target='_blank' href='https://mapv.baidu.com/examples/beijing-village.html'>MapV</a>";
                    new L.supermap.MapVLayer(dataSet, options, { attributionPrefix: dataAttr }).addTo(map);

                    setTimeout(function() {
                        map.openPopup(resources.text_iClient, map.getCenter());
                    }, 1000);
                });
            }
        </script>
    </body>
</html>
